<template>
  <div><el-button type="info" @click="goOut">退出</el-button></div>
</template>
<script>
export default {
  methods: {
    async goOut() {
      const res = await this.$confirm('正在进行退出操作, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).catch(err => {
        return err
      })
      if (res !== 'confirm') return this.$message.info('已取消退出')
      this.$message.success('退出成功')
      this.$router.push('/login')
      sessionStorage.clear('token')
    }
  }
}
</script>
<style></style>
